package voinarovskaya.pages;

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.CacheLookup;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;

public class MainPage extends Page {

	@FindBy(how = How.XPATH , using = "//*[@alt=\"Add movie\"]")	
	@CacheLookup
	public WebElement AddMovie;
	
	@FindBy(how = How.XPATH , using = "//header//a/h1")	
	@CacheLookup
	public WebElement GoMain;
	
	@FindBy(how = How.XPATH , using = "//*[@id='results']/a")		
	public List<WebElement> ListFilm;
	
	@FindBy(how = How.ID , using = "q")		
	public WebElement SeachField;
	
	
	
	
	public MainPage(WebDriver webDriver) {
		super(webDriver);
		PageFactory.initElements(webDriver,this);
	}
	
	public AddFilmPage ClickAddMovie(){			
		AddMovie.click();
		return new AddFilmPage(webDriver);
	}
}
